﻿<!--
// This File is part of Innovation Foundry's "QualityHelper Project"
//
// Copyright  2009 Innovation Foundry Pty Ltd
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the
// Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA  02110-1301 USA
// or alternatively it may be downloaded from <http://www.gnu.org/licenses/>.
-->
    <UserControl xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 
                 xmlns:foundin="clr-namespace:InnovationFoundry.QualityHelper.Silverlight"
                 xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"  
                 xmlns:toolkit="clr-namespace:Microsoft.Windows.Controls;assembly=Microsoft.Windows.Controls"
                 xmlns:cfControl="clr-namespace:InnovationFoundry.QualityHelper.Silverlight.Controls.CoverFlow"
                 xmlns:myLayouts="clr-namespace:InnovationFoundry.QualityHelper.Silverlight.Layout"
                xmlns:MenuControl="clr-namespace:InnovationFoundry.QualityHelper.Silverlight.Controls.FishEyeMenu"
                xmlns:zoomControl="clr-namespace:InnovationFoundry.QualityHelper.Silverlight.Controls.Zoom"
                xmlns:coverflow="clr-namespace:InnovationFoundry.QualityHelper.Silverlight.Controls.CoverFlow"
                 x:Class="InnovationFoundry.QualityHelper.Silverlight.MainPage"
                 xmlns:utilities="clr-namespace:InnovationFoundry.QualityHelper.Silverlight.Utilities"
                 xmlns:processScroll="clr-namespace:InnovationFoundry.QualityHelper.Silverlight.Controls.ProcedureScroll"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
    <UserControl.Resources>
        
        <utilities:IconConverter x:Name="IconConverter" />
        <toolkit:HierarchicalDataTemplate x:Name="DocTemplate" ItemsSource="{Binding Path=DocumentObject}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="40"/>
                    <ColumnDefinition Width="128"/>
                </Grid.ColumnDefinitions>
                <Image Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Top" Source="{Binding Converter={StaticResource IconConverter}}" Width="32" Height="32" MaxHeight="32" MaxWidth="32"/>
                <StackPanel Grid.Column="1" Width="128">
                    <!--<ContentPresenter Margin="0 0 4 0" Content="{Binding Converter={StaticResource IconConverter}}" />-->
                    <TextBlock Text="{Binding Path=DocumentName}" FontWeight="Bold" Margin="0,4,0,0" TextWrapping="Wrap"/>
                    <TextBlock Text="{Binding Path=DocumentDescription}" Margin="0,0,0,4" TextWrapping="Wrap"/>
                </StackPanel>
            </Grid>
        </toolkit:HierarchicalDataTemplate>
    </UserControl.Resources>
        <Grid x:Name="LayoutRoot"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <!--Background="Blue"-->
        <Grid.Background>
            <!--<ImageBrush x:Name="appBG"/>-->
            <SolidColorBrush Color="Black"/>
        </Grid.Background>
        <Canvas x:Name="PageRoot" Canvas.ZIndex="100">
            <Image x:Name="AppIcon" Margin="5,5,5,5" Width="64" Height="64" MouseLeftButtonUp="AppIcon_MouseLeftButtonUp" Cursor="Hand"></Image>
        </Canvas>
        <TextBlock x:Name="AppTitle" Margin="80,5,5,5" Foreground="#F7F7F7" FontFamily="Verdana" FontSize="36" FontStretch="Expanded" FontWeight="Normal" MouseLeftButtonUp="AppIcon_MouseLeftButtonUp" Cursor="Hand"><LineBreak/><Run Text="QualityHelper"/></TextBlock>
        <coverflow:CoverFlowControl x:Name="flowControl" VerticalAlignment="Top" Margin="0,120,0,0" HorizontalAlignment="Center" MenuItemClicked="flowControl_MenuItemClicked"/>
        <StackPanel>
            <Grid x:Name="header">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.245*"/>
                    <ColumnDefinition Width="0.755*"/>
                    <ColumnDefinition Width="140"/>                    
					<ColumnDefinition Width="33" />
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="1" Margin="0,40,8,8" Foreground="#FDFDFD" HorizontalAlignment="Right" VerticalAlignment="Bottom"><Run Text="Search:"/></TextBlock>
                <TextBox x:Name="txtSearch" Margin="6,40,0,3" Text="" VerticalAlignment="Bottom" Grid.Column="2" Width="120" KeyDown="txtSearch_KeyDown"/>
                <Image Grid.Column="4" x:Name="HelpIcon" Margin="0,0,5,5" Width="16" Height="16" MouseLeftButtonUp="HelpIcon_MouseLeftButtonUp" Source="Resources/documentinfo.png" Cursor="Hand"></Image>
                <!--<Button Grid.Column="4" Margin="0,0,5,5" VerticalAlignment="Bottom" Content="&gt;&gt;" HorizontalAlignment="Right" UseLayoutRounding="False" x:Name="btnFullscreen" Click="btnFullscreen_Click" Background="{x:Null}" />-->
            </Grid>
            <Grid x:Name="NavMain" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"><!--Background="#333333" -->
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="250"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="250"/>
                </Grid.ColumnDefinitions>
                <Grid Grid.Column="1">
                    <StackPanel>
                            <myLayouts:DockPanel LastChildFill="false" x:Name="myDock" >
                                <!--<Button myLayouts:DockPanel.Dock="Top" HorizontalAlignment="Right" Width="25" Background="Black"  Click="Button_Click" UseLayoutRounding="False" x:Name="FullScreen_Button">
                                    <TextBlock Text=">>"></TextBlock>
                                </Button>-->
                                <TextBlock myLayouts:DockPanel.Dock="Top" HorizontalAlignment="Center"><LineBreak/><Run Foreground="#F7F7F7" x:Name="txtDiagram" FontFamily="Verdana" FontSize="17" FontWeight="Normal" Text=""/></TextBlock>
                                <!--<MenuControl:FishEyeMenu x:Name="Menu" myLayouts:DockPanel.Dock="Bottom" MaxItemHeight="150" MaxItemWidth="150" MenuItemClicked="Menu_MenuItemClicked" MenuItemClickEffect="Bounce" HorizontalAlignment="Center" Height="300">
                                    <MenuControl:FishEyeMenu.Items>
                                        <MenuControl:FishEyeMenuItemCollection>
                                            <MenuControl:FishEyeMenuItem Text="" Tag="Empty">
                                                <MenuControl:FishEyeMenuItem.Content>
                                                    <Rectangle Width="150"/>
                                                </MenuControl:FishEyeMenuItem.Content>
                                            </MenuControl:FishEyeMenuItem>
                                        </MenuControl:FishEyeMenuItemCollection>
                                    </MenuControl:FishEyeMenu.Items>
                                </MenuControl:FishEyeMenu>-->
                                
                            	
                                <!--<myLayouts:DockPanel.Background>
                                    <LinearGradientBrush>
                                        <GradientStop Offset="0" Color="Gray"></GradientStop>
                                        <GradientStop Offset="1" Color="Black"></GradientStop>
                                    </LinearGradientBrush>
                                </myLayouts:DockPanel.Background>-->
                            </myLayouts:DockPanel>

                        <!--<Button x:Name="procQH" Canvas.Top="60" Canvas.Left="30" Click="procQH_Click" Content="QH Procedure (Press)"/>-->
                        <!--<Image x:Name="testImage"></Image>-->
                        <!--<cfControl:CoverFlowControl x:Name="cfControl"  VerticalAlignment="Stretch">
                        </cfControl:CoverFlowControl>
                        
                        <fishEyeMenu:FishEyeMenu x:Name="fishEye" ></fishEyeMenu:FishEyeMenu>-->
                        
                        
                        
                    </StackPanel>
                </Grid>
                <Grid Grid.Column="0" Margin="5,5,5,100" Background="Transparent">
                    <StackPanel x:Name="stackPanelLeft">
                        <Canvas  x:Name="canvasAscendents" Visibility="Collapsed">
                            <myLayouts:DragDropExpander IsExpanded="True" Opacity="0.85" x:Name="expanderAscendents">
                                <myLayouts:DragDropExpander.Header>
                                    <Grid HorizontalAlignment="Left" Height="10">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock Grid.Column="0" Text="Procedure Ascendants" TextDecorations="None" Foreground="GhostWhite" FontSize="13" FontWeight="Normal" FontStyle="Normal" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                                    </Grid>
                                </myLayouts:DragDropExpander.Header>
                                <Grid VerticalAlignment="Stretch">
                                    <Border BorderBrush="Gray" BorderThickness="1"></Border>
                                    <Grid HorizontalAlignment="Center" VerticalAlignment="Top" x:Name="ReferencesInGrid">
                                        <processScroll:ProcedureScroll x:Name="ReferencesIn"></processScroll:ProcedureScroll>
                                    </Grid>
                                </Grid>
                            </myLayouts:DragDropExpander>
                        </Canvas>
                        <Canvas x:Name="canvasDocs" Visibility="Collapsed">
                            <myLayouts:DragDropExpander IsExpanded="True" Opacity="0.85" x:Name="expanderDocs">
                                <myLayouts:DragDropExpander.Header>
                                    <Grid HorizontalAlignment="Left" Height="10">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock Grid.Column="0" Text="Documents" TextDecorations="None" Foreground="GhostWhite"  FontSize="13" FontWeight="Normal" FontStyle="Normal" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                                    </Grid>
                                </myLayouts:DragDropExpander.Header>
                                <Grid VerticalAlignment="Stretch">
                                    <ScrollViewer VerticalAlignment="Stretch">
                                        <!--<telerikNavigation:RadTreeView x:Name="documents" MouseLeftButtonUp="documents_MouseLeftButtonUp"></telerikNavigation:RadTreeView>-->
                                        <toolkit:TreeView x:Name="treeDocs" ItemTemplate="{StaticResource DocTemplate}" MouseLeftButtonUp="documents_MouseLeftButtonUp"/>
                                    </ScrollViewer>
                                </Grid>
                            </myLayouts:DragDropExpander>
                        </Canvas>
                    </StackPanel>                 
                </Grid>
                <Grid Grid.Column="2" VerticalAlignment="Stretch">
                    <StackPanel x:Name="stackPanelRight" VerticalAlignment="Stretch">
                    <Canvas x:Name="canvasDescendents" Visibility="Collapsed">
                        <myLayouts:DragDropExpander IsExpanded="True" Opacity="0.85" x:Name="expanderDescendents">
                            <myLayouts:DragDropExpander.Header>
                                <Grid HorizontalAlignment="Left" Height="10">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="0" Text="Procedure Descendants" TextDecorations="None" Foreground="GhostWhite" FontSize="13" FontWeight="Normal" FontStyle="Normal" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                                </Grid>
                            </myLayouts:DragDropExpander.Header>
                            <Grid VerticalAlignment="Stretch">
                                <Border BorderBrush="Gray" BorderThickness="1"></Border>
                                <Grid HorizontalAlignment="Center" VerticalAlignment="Top" x:Name="ReferencesOutGrid">
                                    <processScroll:ProcedureScroll x:Name="ReferencesOut"></processScroll:ProcedureScroll>
                                </Grid>
                            </Grid>
                        </myLayouts:DragDropExpander>
                    </Canvas>
                        <Canvas x:Name="canvasProcInfo" Visibility="Collapsed">
                            <myLayouts:DragDropExpander IsExpanded="False" Opacity="0.85" x:Name="expanderProcInfo">
                                <myLayouts:DragDropExpander.Header>
                                    <Grid HorizontalAlignment="Left" Height="10">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock Grid.Column="0" Text="Procedure Info" TextDecorations="None" Foreground="GhostWhite" FontSize="13" FontWeight="Normal" FontStyle="Normal" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                                    </Grid>
                                </myLayouts:DragDropExpander.Header>
                                <Grid VerticalAlignment="Stretch">
                                    <ScrollViewer VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto">
                                        <StackPanel Background="White" HorizontalAlignment="Stretch" x:Name="procInfo">
                                        </StackPanel>
                                    </ScrollViewer>
                                </Grid>
                            </myLayouts:DragDropExpander>
                        </Canvas>
                        <Canvas x:Name="canvasSmallSearchProcs" Visibility="Collapsed">
                            <myLayouts:DragDropExpander IsExpanded="True" Opacity="0.85" x:Name="expanderSmallSearchProcs">
                                <myLayouts:DragDropExpander.Header>
                                    <TextBlock Text="Procedure Search Results" TextDecorations="None" Foreground="GhostWhite" FontSize="13" FontWeight="Normal" FontStyle="Normal" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                                </myLayouts:DragDropExpander.Header>
                                <Grid VerticalAlignment="Stretch">
                                    <ScrollViewer VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto">
                                        <StackPanel VerticalAlignment="Stretch">
                                            <data:DataGrid x:Name="searchResultProceduresSmall" AutoGenerateColumns="False"  GridLinesVisibility="None" HeadersVisibility="All" RowBackground="Cornsilk" AlternatingRowBackground="LemonChiffon" ColumnWidth="85" RowHeight="30" IsReadOnly="True" CanUserResizeColumns="False" VerticalAlignment="Stretch" MouseLeftButtonUp="searchResultProceduresSmall_MouseLeftButtonUp" SelectionMode="Single" >
                                                <data:DataGrid.Columns>
                                                    <!--<data:DataGridTextColumn Header="ID" Binding="{Binding Path=ProcedureID}" />-->
                                                    <data:DataGridTextColumn Header="Name" Binding="{Binding Path=ProcedureName}" Width="180"/>
                                                </data:DataGrid.Columns>
                                                <data:DataGrid.RowDetailsTemplate>
                                                    <DataTemplate>
                                                        <Grid>
                                                            <TextBlock Text="ID: " Margin="0,0,0,0"></TextBlock>
                                                            <TextBlock Text="{Binding Path=ProcedureID}" Margin="20,0,0,0">
                                                            </TextBlock>
                                                            <StackPanel>
                                                                <TextBlock Text=" " Margin="0,0,0,0"></TextBlock>
                                                                <TextBlock Text="{Binding Path=ProcedureDescription}" TextWrapping="Wrap"/>
                                                            </StackPanel>
                                                        </Grid>
                                                    </DataTemplate>
                                                </data:DataGrid.RowDetailsTemplate>
                                            </data:DataGrid>
                                        </StackPanel>
                                    </ScrollViewer>
                                </Grid>
                            </myLayouts:DragDropExpander>
                        </Canvas>
                        <Canvas x:Name="canvasSmallSearchDocs" Visibility="Collapsed">
                            <myLayouts:DragDropExpander IsExpanded="True" Opacity="0.85" x:Name="expanderSmallSearchDocs">
                                <myLayouts:DragDropExpander.Header>
                                    <TextBlock Text="Document Search Results" TextDecorations="None" Foreground="GhostWhite" FontSize="13" FontWeight="Normal" FontStyle="Normal" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                                </myLayouts:DragDropExpander.Header>
                                <Grid VerticalAlignment="Stretch">
                                    <ScrollViewer VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto">
                                        <StackPanel VerticalAlignment="Stretch">
                                            <data:DataGrid x:Name="searchResultDocumentsSmall" AutoGenerateColumns="False" GridLinesVisibility="None" HeadersVisibility="All" RowBackground="Cornsilk" AlternatingRowBackground="LemonChiffon" ColumnWidth="85" RowHeight="30" IsReadOnly="True" CanUserResizeColumns="False" VerticalAlignment="Stretch" MouseLeftButtonUp="searchResultDocumentsSmall_MouseLeftButtonUp" >
                                                <data:DataGrid.Columns>
                                                    <data:DataGridTextColumn Header="ID" Binding="{Binding Path=DocumentID}" Width="40"/>
                                                    <data:DataGridTextColumn Header="Name" Binding="{Binding Path=DocumentName}"/>
                                                </data:DataGrid.Columns>
                                                <data:DataGrid.RowDetailsTemplate>
                                                    <DataTemplate>
                                                        <Grid>
                                                            <StackPanel>
                                                                <TextBlock Text="{Binding Path=DocumentDescription}" TextWrapping="Wrap"/>
                                                                <TextBlock Text="{Binding Path=DateUpdated}" FontSize="6"/>
                                                            </StackPanel>
                                                        </Grid>
                                                    </DataTemplate>
                                                </data:DataGrid.RowDetailsTemplate>
                                            </data:DataGrid>
                                        </StackPanel>
                                    </ScrollViewer>
                                </Grid>
                            </myLayouts:DragDropExpander>
                        </Canvas>
                    </StackPanel>
                </Grid>
            </Grid>
        </StackPanel>
    </Grid>
</UserControl>
